<?php

namespace Modules\ShopAdmin\Models;
use Illuminate\Support\Facades\DB;   
class ShopProductAttrbuteKey extends BaseShopModel
{	
	/**
     * @name  关联商品分类
     */
    public function product_type_to()
    {
        return $this->belongsTo('Modules\ShopAdmin\Models\ShopProductType','product_type_id','id');
    }
	/**
     * @name  关联商品属性
     */
    public function attrbute_value_to()
    {
        return $this->hasMany('Modules\ShopAdmin\Models\ShopProductAttrbuteValue','attrbute_key_id','id');
    }
	/**
     * @name  解析列表数据
     */
    public static function attrbute_key_list($data)
    {
        foreach($data as $k=>$v){
			$data[$k]['type_title'] = $v['product_type_to']['title'];
		}
		return $data;
    }
	
}
